﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace BookStore.admin
{
    public partial class QuanLiHoaDon : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow && GridView2.EditIndex != e.Row.DataItemIndex)
            {
                Label lblMaKH = (Label)e.Row.FindControl("MaKH");
                int MaKH = Convert.ToInt32(lblMaKH.Text);

                using (var context = new BookStoreEntities())
                {
                    BookStore.KhachHang k = (from n in context.KhachHangs
                                   where n.MaKhachHang == MaKH
                                   select n).First();
                    lblMaKH.Text = k.TenKhachHang;
                }
            }
        }
    }
}